import {request, handleFetchResultNotification, REQUEST_TYPE} from '../utils';
import {formatMessage} from './intl';
import stringify from 'Shared/utils/stringify';
import {List, InitData} from './DTO';
const baseUrl = '/afterSales/api/v1';
const getInitdesc = formatMessage({
    id: 'api.message.getInitdesc',
    defaultMessage: '初始化汇率信息'
});
const resourceName = formatMessage({
    id: 'api.resourceName',
    defaultMessage: '汇率管理'
});
const getListDesc = formatMessage({
    id: 'api.message.getListDesc',
    defaultMessage: '查询{resourceName}'
}, {resourceName});
//初始化
export const getInitData = () => request(`${baseUrl}/ui/exchangeRateRecord/init`, null, InitData)
    .then(handleFetchResultNotification(REQUEST_TYPE.initQuery, getInitdesc));
// 查询
export const getList = queryCondition => {
    const queryString = stringify(queryCondition);
    return request(`${baseUrl}/exchangeRateRecords?${queryString}`, null, List)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};
